<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	// 1- Object.keys Object.values Object.assign
	// let obj = {
	// 	a:1,
	// 	b:2,
	// 	c:3
	// }
	// console.log(Object.keys(obj));// ["a","b","c"]
	// console.log(Object.values(obj));// [1,2,3]
	// const obj2 = Object.assign(obj,{my:"wangwu"});
	// console.log(obj === obj2,obj);
	
	// 2- Object.defineProperty
	const obj = {};
	Object.defineProperty(obj,"age",{
		get:function(){
			// 在读取obj.age属性值时执行
			return 200
		},
		set:function(v){
			// 在设置obj.age属性值时执行
			console.log(v);// 100
		}
	});
	obj.age = 300;
	console.log(obj.age);// 200
</script>

</html>